//
//  FRQRemoveSelectedWalletViewController.m
//  FRQBluetoothKit_Example
//
//  Created by admin on 2023/10/24.
//  Copyright © 2023 xuchunhai. All rights reserved.
//

#import "FRQRemoveSelectedWalletViewController.h"
#import "RemoveSelectedWalletView.h"
#import "RemoveSuccessViews.h"
#import "FRQWalletVerificationViewController.h"
@interface FRQRemoveSelectedWalletViewController ()
@property (nonatomic,strong) RemoveSelectedWalletView *removeSelectedWalletView;
@property (nonatomic,strong) RemoveSuccessViews *RemoveSuccessView;
@end

@implementation FRQRemoveSelectedWalletViewController
- (RemoveSelectedWalletView *)removeSelectedWalletView{
    if (nil==_removeSelectedWalletView) {
        _removeSelectedWalletView=skXibView(@"RemoveSelectedWalletView");
        [self.view addSubview:_removeSelectedWalletView];
        [_removeSelectedWalletView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_topLayoutGuide);
            make.bottom.mas_equalTo(self.mas_bottomLayoutGuide);
            make.right.left.mas_equalTo(0);
        }];
        @weakify(self)
        [[_removeSelectedWalletView.btnYES rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self)
            NSDictionary *dic=@{
                @"walletIds":self.walletId
            };
            
            [skNetTools skPOSTWithURL:[NSString stringWithFormat:@"%@%@",skURL,@"app/user/wallet/deleteWallet"] parameters:dic cachePolicy:0 callback:^(id  _Nonnull responseObject, NSError * _Nonnull error) {
                NSLog(@"数据=%@",responseObject);
                skNetModel *model=responseObject;
                if(model.code==200){
                    self.removeSelectedWalletView.hidden=YES;
                    self.RemoveSuccessView.hidden=NO;
                }else{
                    [SkToast SkToastShow:model.msg];
                }
            }];
        }];
        [[_removeSelectedWalletView.btnNo rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self)
            [self dismissViewControllerAnimated:YES completion:^{
                
            }];
        }];
        [[_removeSelectedWalletView.btnBack rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self)
            [self dismissViewControllerAnimated:YES completion:^{
                
            }];
        }];
    }
    return _removeSelectedWalletView;
}
- (RemoveSuccessViews *)RemoveSuccessView{
    if (nil==_RemoveSuccessView) {
        _RemoveSuccessView=skXibView(@"RemoveSuccessViews");
        [self.view addSubview:_RemoveSuccessView];
        [_RemoveSuccessView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(APP.statusBarHeight);
            make.bottom.mas_equalTo(self.mas_bottomLayoutGuide);
            make.right.left.mas_equalTo(0);
        }];
        @weakify(self)
        [[_RemoveSuccessView.btnBackWallets rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self)
            [self dismissViewControllerAnimated:YES completion:^{
                
            }];
        }];
        
    }
    return _RemoveSuccessView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.removeSelectedWalletView.hidden=NO;
    self.RemoveSuccessView.hidden=YES;
    // Do any additional setup after loading the view.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
